//
//  ZWLikeVC.m
//  WanEr
//
//  Created by 高文萍 on 15/12/20.
//  Copyright © 2015年 高文萍. All rights reserved.
//

#import "ZWLikeVC.h"
#import "WanErHeader.h"

@interface ZWLikeVC ()<UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) UITableView *likeTable;
//透视图所需
@property (nonatomic, strong) ZWBaseButton *returnButton;
@property (nonatomic, strong) ZWBaseButton * chou_tiBut;
@property (nonatomic, strong) UIView *headerView;
@property (nonatomic, strong) UIImageView *headImgView;
@property (nonatomic, strong) UIImageView *peopleImg;
@property (nonatomic, strong) UILabel *nameLab;
@property (nonatomic, strong) UIView *backButtonView;
@property (nonatomic, strong) ZWBaseButton *loadFButton;
@property (nonatomic, strong) ZWBaseButton *viewTButton;
@property (nonatomic, strong) ZWBaseButton *cityThButton;
@property (nonatomic, strong) ZWBaseButton *playerButton;
@property (nonatomic, strong) ZWBaseButton *playerTextBut;
@property (nonatomic, strong) UIView *backLineView;

@end

@implementation ZWLikeVC

- (void)viewDidLoad {
    [super viewDidLoad];
   
    self.likeTable = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT) style:UITableViewStylePlain];
    self.likeTable.delegate = self;
    self.likeTable.dataSource = self;
    [self.view addSubview:self.likeTable];
    
    self.headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT / 2 + 10)];
    self.likeTable.tableHeaderView = self.headerView;
    
    [self createHeaderView];
    
}

- (void)createHeaderView
{
    self.headImgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"配图"]];
    self.headImgView.frame = CGRectMake(0, 0, WIDTH, self.headerView.frame.size.height / 4 * 3 - 10);
    [self.headerView addSubview:self.headImgView];
    
    self.peopleImg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"头像"]];
    self.peopleImg.frame = CGRectMake(20, self.headImgView.frame.size.height - 80, 60, 60);
    self.peopleImg.layer.borderWidth = 1;
    self.peopleImg.layer.cornerRadius = 30;
    self.peopleImg.layer.borderColor = [UIColor whiteColor].CGColor;
    self.peopleImg.layer.masksToBounds = YES;
    [self.headerView addSubview:self.peopleImg];
    
    self.nameLab = [[UILabel alloc]initWithFrame:CGRectMake(20 + self.peopleImg.frame.size.width + 10, self.headImgView.frame.size.height - 80, 100, 60)];
    self.nameLab.text = @"名字";
    self.nameLab.font = [UIFont systemFontOfSize:16];
    self.nameLab.textColor = [UIColor whiteColor];
    [self.headerView addSubview:self.nameLab];
    
    self.backButtonView = [[UIView alloc]initWithFrame:CGRectMake(0, self.headImgView.frame.size.height, WIDTH, 45)];
    self.backButtonView.backgroundColor = [UIColor colorWithRed:0.851 green:0.861 blue:0.903 alpha:1.000];
    [self.headerView addSubview:self.backButtonView];
    
    // 三个按钮
    self.loadFButton = [ZWBaseButton baseButtonFrame:CGRectMake(0, 0, WIDTH / 3, self.backButtonView.frame.size.height) buttonType:UIButtonTypeCustom buttonTitle:@"街景" buttonTitleColor:[UIColor colorWithRed:0.192 green:0.193 blue:0.204 alpha:1.000] buttonTag:1000 buttonImage:nil];
    [self.loadFButton addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    self.loadFButton.titleLabel.font = [UIFont systemFontOfSize:16];
    [self.backButtonView addSubview:self.loadFButton];
    
    self.viewTButton = [ZWBaseButton baseButtonFrame:CGRectMake(WIDTH / 3, 0, WIDTH / 3, self.backButtonView.frame.size.height) buttonType:UIButtonTypeCustom buttonTitle:@"景点" buttonTitleColor:[UIColor colorWithRed:0.192 green:0.193 blue:0.204 alpha:1.000] buttonTag:1001 buttonImage:nil];
    [self.viewTButton addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    self.viewTButton.titleLabel.font = [UIFont systemFontOfSize:16];
    [self.backButtonView addSubview:self.viewTButton];
    
    self.cityThButton = [ZWBaseButton baseButtonFrame:CGRectMake(WIDTH / 3 * 2, 0, WIDTH / 3, self.backButtonView.frame.size.height) buttonType:UIButtonTypeCustom buttonTitle:@"城市" buttonTitleColor:[UIColor colorWithRed:0.192 green:0.193 blue:0.204 alpha:1.000] buttonTag:1002 buttonImage:nil];
    [self.cityThButton addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    self.cityThButton.titleLabel.font = [UIFont systemFontOfSize:16];
    [self.backButtonView addSubview:self.cityThButton];
    
    // 播放全部按钮
    self.playerButton = [ZWBaseButton baseButtonFrame:CGRectMake(20,self.headImgView.frame.size.height + self.backButtonView.frame.size.height + 5, 25, 25) buttonType:UIButtonTypeCustom buttonTitle:nil buttonTitleColor:nil buttonTag:1003 buttonImage:[UIImage imageNamed:@"播放按钮"]];
    [self.playerButton addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    [self.headerView addSubview:self.playerButton];
    
    self.playerTextBut = [ZWBaseButton baseButtonFrame:CGRectMake(20 + 25, self.headImgView.frame.size.height + self.backButtonView.frame.size.height + 5, 80, 25) buttonType:UIButtonTypeCustom buttonTitle:@"全部播放" buttonTitleColor:[UIColor colorWithWhite:0.190 alpha:1.000] buttonTag:1003 buttonImage:nil];
    self.playerTextBut.titleLabel.font = [UIFont systemFontOfSize:16];
    self.playerTextBut.titleLabel.textAlignment = NSTextAlignmentLeft;
    [self.playerTextBut addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    [self.headerView addSubview:self.playerTextBut];
    
    // 分割线
    self.backLineView = [[UIView alloc]initWithFrame:CGRectMake(20, self.headerView.frame.size.height, WIDTH - 40, 1)];
    self.backLineView.backgroundColor = [UIColor colorWithWhite:0.779 alpha:1.000];
    [self.headerView addSubview:self.backLineView];
    
    // 返回按钮
    self.returnButton = [ZWBaseButton baseButtonFrame:CGRectMake(20, 20, 15, 12) buttonType:UIButtonTypeCustom buttonTitle:nil buttonTitleColor:nil buttonTag:1004 buttonImage:[UIImage imageNamed:@"返回"]];
    [self.returnButton addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    [self.headerView addSubview:self.returnButton];

    
    self.chou_tiBut = [ZWBaseButton baseButtonFrame:CGRectMake(WIDTH - 20 - 15, 20, 15, 12) buttonType:UIButtonTypeCustom buttonTitle:nil buttonTitleColor:nil buttonTag:1006 buttonImage:[UIImage imageNamed:@"功能键"]];
    [self.chou_tiBut addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    [self.headerView addSubview:self.chou_tiBut];
}

- (void)click:(UIButton *)button
{
    
    switch (button.tag) {
        case 1000:{
            NSLog(@"街景");
            break;
        }
        case 1001:{
            NSLog(@"景点");
            break;
        }
        case 1002:{
            NSLog(@"城市");
            break;
        }
        case 1003:{
            NSLog(@"播放全部");
            break;
        }
        case 1004:{
             NSLog(@"返回");
            [self.navigationController popViewControllerAnimated:YES];
            break;
        }
        case 1006:{
            NSLog(@"抽屉");
            
            
            
            break;
        }
            
        default:
            break;
    }
    
    
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *reuse = @"likeReuse";
    UITableViewCell *likeCell = [tableView dequeueReusableCellWithIdentifier:reuse];
    if (!likeCell) {
        likeCell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:reuse];
    }
    
    return likeCell;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
